package com.cabbagetofu.crowd.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class CrowdWebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {

        // view-controller 是在 project-consumer 内部定义的，所以这里是一个不经过 Zuul
        // 访问的地址，所以这个路径前面不加路由规则中定义的前缀：“/project”

        // 转发至同意协议页面
        registry.addViewController("/agree/protocol/page").setViewName("project-agree");

        // 转发至发起项目页面
        registry.addViewController("/launch/project/page").setViewName("project-launch");

        // 转发至回报页面
        registry.addViewController("/return/project/page").setViewName("project-return");

        // 转发至确认信息页面
        registry.addViewController("/create/confirm/page").setViewName("project-confirm");

        // 转发至“完成”页面
        registry.addViewController("/create/success/page").setViewName("project-success");

    }
}
